#!/bin/bash

HEADERS=test_1234.h

COMPSTR=VERSION

if [ -f ../bases/base.sh ]; then
    . ../bases/base.sh
fi

if [ ! -f setlocalversion ]; then
    log_e "You must give setlocalversion"
    exit
fi

realver=`./setlocalversion`

function set_header_tofile() {
    filename=$1
    if [ ! -f $filename ]; then
        log_e "$filename not exist, we can not do anything"
    else
        sed -i "/$COMPSTR=/c \ $COMPSTR=$realver" $filename
        #sed -i '/VERSION=/c \VERSION=1232' $filename
    fi
}

for i in $HEADERS; do
    set_header_tofile $i
done

log "\t Do done."

